unit unilRelEstoqueAtual;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, QRCtrls, jpeg, QuickRpt, ExtCtrls, DB, ADODB;

type
  TfrmRelEstoqueAtual = class(TForm)
    qrpRel: TQuickRep;
    QRBand1: TQRBand;
    QRLabel1: TQRLabel;
    qrlTitulo: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel7: TQRLabel;
    qrImgCliente: TQRImage;
    QRLabel2: TQRLabel;
    qrbDetalhe: TQRBand;
    qrlQuantidade: TQRLabel;
    qrlUnidade: TQRLabel;
    QRBand3: TQRBand;
    QRSysData1: TQRSysData;
    qrlMaterial: TQRLabel;
    QR_Rel: TADOQuery;
    DS_Rel: TDataSource;
    procedure qrbDetalheBeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure qrpRelBeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
  private
    intLinha :integer;
  public
    { Public declarations }
  end;

var
  frmRelEstoqueAtual: TfrmRelEstoqueAtual;

implementation

{$R *.dfm}

procedure TfrmRelEstoqueAtual.qrbDetalheBeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
   var colCorBanda : TColor;
   intContador:integer;
begin
     if ((intLinha mod 2) = 0) then
      colCorBanda := TColor(RGB(255,255,255))
   else
      colCorBanda := TColor(RGB(230,230,230));

   for intContador := 0 to qrbDetalhe.ControlCount - 1 do
   begin
       if qrbDetalhe.Controls[intContador] is TQRLabel then
          (qrbDetalhe.Controls[intContador] as TQRLabel).Color := colCorBanda;
           qrbDetalhe.Color := colCorBanda;
   end;
  qrlMaterial.Caption := QR_Rel.FieldByName('descricao').AsString;
  
  qrlQuantidade.Caption := IntToStr(QR_Rel.FieldByName('estoque_atual').AsInteger);
  qrlUnidade.Caption := QR_Rel.FieldByName('unidade_medida').AsString;
   inc(intLinha);
end;

procedure TfrmRelEstoqueAtual.qrpRelBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
   QR_Rel.Open;
end;

end.
